/*
 * Created by SharpDevelop.
 * User: David
 * Date: 2006-12-20
 * Time: 03:37
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using Labb4.Pooman.Cards;
using Labb4.Pooman.Players;

namespace Labb4.Pooman.Game
{
	/// <summary>
	/// The state of the table during the game's first phase
	/// </summary>
	public class TableGameStatePhase1 : TableGameState
	{
		#region constructors
		
		/// <summary>
		/// Constructor, does nothing
		/// </summary>
		public TableGameStatePhase1() :
			base()
		{
		}
		
		#endregion
		
		#region overrides
		
		/// <summary>
		/// See <see cref="GameState#GetCards">GameState</see>
		/// </summary>
		/// <param name="player">The player who should get cards</param>
		public override void GetCards(Player player)
		{
			CardPile cards = new CardPile();
			
			foreach(CardPile itPile in Table.Instance.CardsOnTable)
			{
				cards.Add(itPile);
				
				foreach(Card itCard in itPile)
				{
					itCard.ResetCard();
				}
			}
			
			player.TakeCards(cards);
			Table.Instance.CardsOnTable.Clear();
		}
		
		#endregion
	}
}
